<?php

/**
 * Contains a class to define a Message object to describe a system message.
 *
 * PHP Version 5
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */
 
/**
 * A class to define a Message object to describe a system message.
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */ 
class Message
{
    /**
     * The database unique ID for the message.
     *
     * @access public
     * @var int       Corresponds to messages.messageid
     */
    public $id;
    
    /**
     * A User object for who the message is to.
     *
     * @access public
     * @var object    Corresponds to messages.to
     */
    public $to;
    
    /**
     * A User object for who the message is from.
     *
     * @access public
     * @var object    Corresponds to messages.from
     */
    public $from;
    
    /**
     * The title of the message.
     *
     * @access public
     * @var string    Corresponds to messages.title
     */
    public $title;
    
    /**
     * The body of the message.
     *
     * @access public
     * @var string    Corresponds to messages.body
     */
    public $body;
    
    /**
     * The UNIX timestamp of the date and time that the message was created.
     *
     * @access public
     * @var int       Corresponds to messages.created
     */
    public $created;
    
    /**
     * A boolean flag demonstrating whether the message has been read.
     *
     * @access public
     * @var bool      Corresponds to messages.isread
     */
    public $isRead;
    
    /**
     * Constructor function.  Populates variables based on parameters.
     *
     * @param int    $id      The unique ID of the message.
     * @param object $to      Who the message is sent to.
     * @param object $from    Who the message is from.
     * @param string $title   The title of the message.
     * @param string $body    The body of the message.
     * @param int    $created When the message was created.
     * @param bool   $isRead  Whether the message has been read or not.
     *
     * @access public
     * @return null
     */
    public function __construct($id = null, $to = null, $from = null,
        $title = null, $body = null, $created = null, $isRead = null
    ) {
        $this->id      = $id;
        $this->to      = $to;
        $this->from    = $from;
        $this->title   = $title;
        $this->body    = $body;
        $this->created = $created;
        $this->isRead  = $isRead;
    }
}

?>